Hands-On Artificial Intelligence for Search by Devangini Patel

Hands-On Artificial Intelligence for Search by Devangini Patel

Author:Devangini Patel
Language: eng
Format: epub
Tags: COM014000 - COMPUTERS / Computer Science, COM060120 - COMPUTERS / Web / Search Engines, COM025000 - COMPUTERS / Expert Systems
Publisher: Packt Publishing
Published: 2018-08-30T10:03:58+00:00


Figure 9

In the next section, you'll learn about the queue data structure, which forms the basis of node reversal, just like a stack in the DFS method.

Queue data structure

A queue is a sequence of people or objects waiting to be attended to. Some examples include a queue of people waiting at a counter, a queue of swimmers that are ready to dive in to a pool, and a queue of songs in a playlist:

Figure 10

Just like in a stack, there are two types of operations—one for inserting items into a queue, and one for removing items from a queue. When a person joins a queue, he or she must stand behind the last person. The operation of adding an item to a queue is called enqueue. The first person to be attended to in a queue is the person standing in the front. The operation to remove an item from a queue is called dequeue. Queue operations can be seen in the following diagram:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.